package Java攻略._3_流式操作._4_利用reduce方法校验排序;

import java.util.Arrays;
import java.util.List;

public class _31_测试字符串排序是否正确 {

    public static void main(String[] args) {

        List<String> strings = Arrays.asList(
                "a", "is", "of", "this", "list", "strings");

        String s = strings.stream()
                .reduce((prev, curr) -> {
                    if (prev.length() <= curr.length()) {
                        return curr;
                    }
                    return prev;
                }).toString();
        System.out.println(s);
    }
}
